From 92ba19d639cc4751683e74663b1211ed49ffec24 Mon Sep 17 00:00:00 2001 From: "mjw@wray-m-3.hpl.hp.com" Date: Fri, 27 Aug 2004 08:42:25 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.110 (412ef3f1vl_4cVn-pCxQHFvK5hcIZQ) Raise an error if a device cannot be found. This prevents constructing a block device that will then cause errors because its vdev is not set. --- tools/python/xen/xend/XendDomainInfo.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index dabcb68e7e..673153dd66 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -132,8 +132,11 @@ def lookup_raw_partn(name): def lookup_disk_uname(uname): """Lookup a list of segments for a physical device. - uname [string]: name of the device in the format \'phy:dev\' for a physical device - returns [list of dicts]: list of extents that make up the named device + + @param uname: name of the device in the format \'phy:dev\' for a physical device + @type uname: string + @return: list of extents that make up the named device + @rtype: [dict] """ ( type, d_name ) = string.split( uname, ':' ) @@ -159,14 +162,17 @@ def make_disk(vm, config, uname, dev, mode, recreate=0): if len(segments) > 1: raise VmError("vbd: Multi-segment vdisk: uname=%s" % uname) segment = segments[0] + # todo: The 'dev' should be looked up in the context of the domain. vdev = blkdev_name_to_number(dev) + if not vdev: + raise VmError("vbd: Device not found: uname=%s dev=%s" % (uname, dev)) ctrl = xend.blkif_create(vm.dom, recreate=recreate) return ctrl.attachDevice(config, vdev, mode, segment, recreate=recreate) def vif_up(iplist): """send an unsolicited ARP reply for all non link-local IP addresses. - iplist IP addresses + @param iplist: IP addresses """ IP_NONLOCAL_BIND = '/proc/sys/net/ipv4/ip_nonlocal_bind' -- 2.30.2